import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import VueUse from '@/view/vueUse.vue';
import Layout from '@/layout/index.vue';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: '首页',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: '/',
        redirect: '/pdfjs',
      },
      {
        path: '/vueUse',
        component: VueUse,
      },
      {
        path: '/pdfjs',
        component: () => import('@/view/pdfView/pdfjsview.vue'),
      },
      {
        path: '/login',
        component: () => import('@/view/login.vue'),
      },
      {
        path: '/home',
        component: () => import('@/view/home.vue'),
      },
      {
        path: '/useHook',
        component: () => import('@/view/useHook.vue'),
      },
      {
        path: '/draggable',
        component: () => import('@/view/draggable.vue'),
      },
      {
        path: '/copy',
        component: () => import('@/view/copy.vue'),
      },
      {
        path: '/upload',
        component: () => import('@/view/upload.vue'),
      },
      {
        path: '/voice',
        component: () => import('@/view/voicePlayback/index.vue'),
      },
      {
        path: '/canvas',
        component: () => import('@/view/canvas/index.vue'),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
